<%@page import="com.system.dao.DoctorDao"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="ui" uri="http://com.am.tag" %>
<%@ include file="../common.jsp" %>
<%
	String record_id = request.getParameter("record_id");
	DoctorDao dao = new DoctorDao();
	Map<String,Object> map = dao.getdiseaseLeaveInfo(record_id);
	pageContext.setAttribute("map", map);
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>病假单</title>
    <style type="text/css">
    	
    </style>
     <!-- 插入打印控件 -->
      <OBJECT  ID="jatoolsPrinter" CLASSID="CLSID:B43D3361-D075-4BE2-87FE-057188254255"
                  codebase="jatoolsPrinter.cab#version=8,6,0,0"></OBJECT>  
    
    <script type="text/javascript">
    	function doPrint(how) { 
   			 var myDoc = {
   			 	settings:{paperName:'a5'},   // 选择a4纸张进行打印
   			 	//settings:{orientation:2},   // 选择横向打印,1为纵向，2为横向
   			 	//settings:{topMargin:100,
		                  //leftMargin:100,
		                  //bottomMargin:100,
		                  //rightMargin:100},   // 设置上下左距页边距为10毫米，注意，单位是 1/10毫米
		        //settings:{printer:'OKi5530'},//设置到打印机 'OKi5530'
		        
        		documents: document,
        		copyrights: '杰创软件拥有版权  www.jatools.com'
   			 }; 
	   		 if (how == '打印预览...') {
	        	 jatoolsPrinter.printPreview(myDoc);} // 打印预览
	    	 else if (how == '打印...') {
	         	jatoolsPrinter.print(myDoc, false); // 打印前弹出打印设置对话框
	         	}
	    	else
	         	jatoolsPrinter.print(myDoc, false); // 不弹出对话框打印
		}
    
    
    	$().ready(function(){
    		$("#create_time").val(new Date().toLocaleDateString());
    		$("#print_time").val("时间: "+new Date().toLocaleTimeString());
    	});
    
    	function doCheck()
    	{
    		//验证请假天数输入内容
	 		if($.trim($("#days").val()) == ""){
	 			alert("请假天数不能为空！");
	 			return false;
	 		}
	 		
	 		if(!check_integer($.trim($("#days").val()))){
	 			alert("请输入数字！");
				return false;
	 		}
	 		
	 		if(parseInt($.trim($("#days").val()))>3){
	 			alert("请假天数不能大于3天！");
	 			return false;
	 		}
	 		
	 		return true;
    	}
    	
    	function doSave()
    	{
    		if(doCheck())
    		{
    			doPrint('打印...');
    			var map = Form.formToBean("winForm");
		 		map.record_id = "${param.record_id}";
		 	
		 		ajax.remoteCall("com.system.dao.DoctorDao:diseaseLeave",[map],function(reply){
		 			var result = reply.getResult();
		 			alert(result.value);
		 			if(result.type == "success")
		 			{
		 				 Dialog.getInstance("view").close();
		 			}
		 		});
    		}
    		$("#surePrint").click();
	 	}
	 	
    </script>
 </head>
  
  <body style="overflow-x: hidden;overflow-y:hidden;">
  <form id="winForm" name="winForm">
 			<input id="diseaseLeaveId" name="diseaseLeaveId" type="hidden" value="${map['id']}">
 			<input id="className" name="className" type="hidden" value="">
 			<%-- <div style="margin-left:350px;margin-top:10px;">
 				<ui:Permission value="doctor_diagnose_print">
 					<input type="button" id="surePrint"  style="background:url(${path }/images/common/hp_printer.png); width:64px;height:64;border:0" onclick="doPrint('打印预览...')">
 				</ui:Permission>
 			</div> --%>
			<div id="page1" style="text-align:center;padding-top:60px">
			    <span style="font-weight:bold;font-size:30">广东技术师范学院门诊部</span><br/>
			    <span style="font-weight:bold;font-size:30">病假疾病诊断证明书</span>
			    <div style="width:100%;margin-top:15px;">
			   		<div style="float:right"><input type="text" id="print_time" name="print_time" style="height:30px;width:180px;border:0px;vertical-align:middle"></div>
				</div>
			    <div style="width:100%;margin-top:5px;">
					<div style="display:inline;"><span style="font-size:18">${map['class']}&nbsp;&nbsp;${map['name']}</span></div>
					<div style="display:inline;"><span style="font-size:18">同志</span></div>
			   </div>
			   
			   <div style="width:100%;margin-top:10px;">
			   		<div style="float:center;display:inline;"><span style="font-size:18">患</span></div>
					<div style="float:center;display:inline;"><input type="text" id="sick" name="sick" value="${map['sick']}" style="height:30px;width:100px;font-size:22;border:0px;vertical-align:middle;text-align:center"></div>
					<div style="float:center;display:inline;"><span style="font-size:18">病</span></div>
			   
			   </div>
			   
			   
			   <div style="width:100%;margin-top:10px;margin-left:55px">
					<div style="float:center;display:inline;"><span style="font-size:18">建议休息</span></div>
					<div style="float:center;display:inline;"><input type="text" id="days" name="days" value="${map['days']}" style="height:30px;width:25px;font-size:18;border:0px;vertical-align:middle;text-align:center"></div>
					<div style="float:center;display:inline;"><span style="font-size:18">天(门诊病假3天上限)</span></div>
			   </div>
			   
			    <div style="width:100%;margin-top:35px;">
			    	<div style="margin-left:150px;"><span style="font-size:18">医生签名:${map['user_name']}</span></div>
			    	
			   </div>
			   
			   <div style="width:100%;margin-top:5px;">
			   		<div style="margin-left:180px;"><input type="text" id="create_time" name="create_time" style="height:30px;width:180px;font-size:18;border:0px;vertical-align:middle"></div>
			   </div>
			   <div style="width:100%;margin-top:15px;margin-left:150px;">盖章生效</div>
			   
			</div>	
</form>
  </body>
</html>
